package com.kucai.yifaqapp.presenter.fragment;

import com.kucai.yifaqapp.global.HttpAdress;
import com.kucai.yifaqapp.model.CustomObserver;
import com.kucai.yifaqapp.model.network.HttpJsonUtils;
import com.kucai.yifaqapp.model.network.entity.res.Pay_CunKuanList;
import com.kucai.yifaqapp.ui.fragment.DepositeFragment;
import com.kucai.yifaqapp.util.SYSOUtils;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

public class DepositeFragmentPresenter extends BaseFragmentPresenter<DepositeFragment> {


    public DepositeFragmentPresenter(DepositeFragment mFragment) {
        super(mFragment);
    }

    public void getCunKuanList(String token){
        HttpJsonUtils.getHttpApiInstance()
                .getCunKuanList(HttpAdress.getuseAdress() + "api/m/user/getRechList",token)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new CustomObserver<Pay_CunKuanList>(mFragment) {

                    @Override
                    protected void onCustomNext(Pay_CunKuanList resBanner) {
                        mFragment.onsuccess(resBanner);
                    }

                    @Override
                    protected void onSubscribeCustom(Disposable disposable) {
                    }

                    @Override
                    protected void onErrorCustom(Throwable e) {
                        SYSOUtils.sOut(e.toString());
                    }
                });
    }
}